<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>融资筛选列表</title>
<style type="text/css">
    .searchArea .fieldBox .label{width: 80px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}
</style>
<jsp:include page="../../import.jsp" flush="true" />
<script type="text/javascript" src="<%=path %>/resource/lib/plugins/ajaxfileupload.js"></script>
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar" enctype = “multipart/form-data”>
        <div class="fieldset1 clearFix">
          <div class="fieldBox" >
                <div class="label">融资基数</div>
                <div class="field">
                <select name="fncCrdnlt" id="fncCrdnlt" data-value="${infoVO.fncCrdnlt}" validate="{required:true,select: true}" ligerui="width: 200">
                    	<option value=" " selected="selected">请选择</option>
                         <c:forEach items="${fncCrdnltList }" var="fc">
                     		<option value="${fc.key }">${fc.value }</option>
                        </c:forEach>
                </select>
                <span class="requiredSymbol">*</span>
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">计划融资日期</div>
                <div class="field">
                   <input name="stdt" id="stdt" type="text" ligerui="width: 90" class="ui-datepicker" value="${infoVO.planStdt}" validate="{required:true,dateISO:true}">
                   <span>—</span>
                   <input name="eddt" id="eddt" type="text" ligerui="width: 90" class="ui-datepicker" value="${infoVO.planEddt}">
                	<span class="requiredSymbol">*</span>
                </div>
            </div> 
			<div class="fieldBox">
                <div class="label">客户类型</div>
                <div class="field">
                    <select name="cstTypCd" id="cstTypCd" data-value="${infoVO.cstTypCd}" ligerui="width: 210">
                    	<option value=" " selected="selected">请选择</option>
                         <c:forEach items="${cstTypCdList }" var="ct">
                     		<option value="${ct.key }">${ct.value }</option>
                        </c:forEach>
                    </select>
                </div>
            </div>        
			<div class="fieldBox">
                <div class="label">所属事业部</div>
                <div class="field">
                	<input name="buOrgCd" id="buOrgCd" type="text" class="ui-textbox" data-value=" " placeholder="--请选择--" ltype="combobox" value="" ligerui="width: 210">
                    <input name="buOrgCdValue" id="buOrgCdValue" type="hidden" value="${infoVO.buOrgCd}">
                    <%-- <select name="buOrgCd" id="buOrgCd" data-value="${infoVO.buOrgCd}" ligerui="width: 210">
                    	<option value=" " selected="selected">请选择</option>
                         <c:forEach items="${buOrgCdList }" var="bo">
                     		<option value="${bo.key }">${bo.value }</option>
                        </c:forEach>
                    </select> --%>
                </div>
            </div>        
			<div class="fieldBox">
                <div class="label">是否办理抵押</div>
                <div class="field">
                    <select name="isMortgage" id="isMortgage" data-value="${infoVO.isMgt}" ligerui="width: 210">
                    	<option value=" " selected="selected">请选择</option>
                         <c:forEach items="${isMortgageList }" var="im">
                     		<option value="${im.key }">${im.value }</option>
                        </c:forEach>
                    </select>
                </div>
            </div>        
			<div class="fieldBox">
                <div class="label">是否有保险</div>
                <div class="field">
                    <select name="isInsurance" id="isInsurance" data-value="${infoVO.isInsure}" ligerui="width: 210">
                    	<option value=" " selected="selected">请选择</option>
                         <c:forEach items="${isMortgageList }" var="im">
                     		<option value="${im.key }">${im.value }</option>
                        </c:forEach>
                    </select>
                </div>
            </div>        
            <div class="fieldBox">
                <div class="label">租赁期数</div>
                <div class="field">
                   <input name="leaseTermMinQ" id="leaseTermMinQ" type="text" ligerui="width: 94" class="ui-textbox" value="${infoVO.leaTermB}" validate="{digits:true}">
                   <span>—</span>
                   <input name="leaseTermMaxQ" id="leaseTermMaxQ" type="text" ligerui="width: 94" class="ui-textbox" value="${infoVO.leaTermE}" validate="{digits:true}">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">剩余租赁期数</div>
                <div class="field">
                   <input name="surplusLeaseTermMinQ" id="surplusLeaseTermMinQ" ligerui="width: 94" type="text" class="ui-textbox" value="${infoVO.reLeaTermB}" validate="{digits:true}">
                   <span>—</span>
                   <input name="surplusLeaseTermMaxQ" id="surplusLeaseTermMaxQ" ligerui="width: 94" type="text" class="ui-textbox" value="${infoVO.reLeaTermE}" validate="{digits:true}">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">起租日期</div>
                <div class="field">
                   <input name="stDtQ" id="stDtQ" type="text" ligerui="width: 94" class="ui-datepicker" value="${infoVO.flDateBegin}" validate="{dateISO:true}">
                   <span>—</span>
                   <input name="edDtQ" id="edDtQ" type="text" ligerui="width: 94" class="ui-datepicker" value="${infoVO.flDateEnd}" validate="{dateISO:true}">
                </div>
            </div>
           <div class="fieldBox">
                <div class="label">逾期天数</div>
                <div class="field">
                   <input name="ovdDaysMin" id="ovdDaysMin" type="text" ligerui="width: 94" class="ui-textbox" value="${infoVO.odDateB}" validate="{digits:true}">
                   <span>—</span>
                   <input name="ovdDaysMax" id="ovdDaysMax" type="text" ligerui="width: 94" class="ui-textbox" value="${infoVO.odDateE}" validate="{digits:true}">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">计划融资额</div>
                <div class="field">
                	<input name="financingAmount" id="financingAmount" type="text" ligerui="width: 210" class="ui-textbox" value="" validate="{number:true}">
                </div>
            </div>
            <div class="fieldBox">
                <div class="label">再融资状态</div>
                <div class="field">
                	<input name="financingTypeCd" id="financingTypeCd" type="text" class="ui-textbox" value="" placeholder="--请选择--" ligerui="width: 210">
                </div>
            </div>
           <div class="fieldBox">
                <div class="label">可融资金额</div>
                <div class="field">
                   <span id="isFinancingAmount" ligerui="width: 160">0.00</span>&nbsp;&nbsp;&nbsp;&nbsp;
                </div>
            </div>
           <div class="fieldBox">
                <div class="label">已选数量</div>
                <div class="field">
                   <span id="selectedCount" ligerui="width: 100">0</span>
                   
                   (已占用:<span id="selectedCountOccupy">0</span>条;
                    	未占用:<span id="selectedCountUnOccupy">0</span>条)
                </div>
            </div>
            <div class="clearFix"></div>
            <div class="formBtns notRight">
            	<!-- 隐藏融资筛选编号 -->
				<input name="fncInsIdQ" id="fncInsIdQ" type="hidden" class="ui-textbox" value="${id}">
				<input name="flag" id="flag" type="hidden" class="ui-textbox" value="${flag}">
				<input name="sflag" id="sflag" type="hidden" class="ui-textbox" value="0">
				<input name="assPackName" id="assPackName" type="hidden" class="ui-textbox" value="">
            
                <span id="searchBtn" class="sq-button-round">查询</span>
                <span id="clearBtn" class="sq-button-round">清空</span>
                <span id="addBtn" class="sq-button-round" onclick="addAssPackInfo('0');">新增</span>
                <c:if test="${id != null}">
	                <span id="coverAddBtn" class="sq-button-round" onclick="addAssPackInfo('1');">新增并修改筛选条件</span>
	                
	                <!-- 20181015新增全部资产 -->
	                <span id="addAllBtn" class="sq-button-round" onclick="addAllAssPackInfo('0');">新增全部</span>
	                
                </c:if>
                <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>&nbsp;&nbsp;&nbsp;&nbsp;
            </div>
              <div class="fieldBox">
                  <span id="scm_cost2_EXCEL_INPORT" >
                  	<a id="upmodel" style="color:blue;text-decoration:underline;" href="<%=path %>/resource/template/reffile/paycddemo.xls" />模板样例下载</a>&nbsp;&nbsp;&nbsp;&nbsp;
				</span>
                  <span id="scm_cost2_EXCEL_INPORT" >
				   <input type="file" id="upfile" name="upfile" /><span class="sq-button sq-button-round" onclick="ReadExcel();" >导入</span>
				   <span class="sq-button sq-button-round" onclick="showOldPayCode();" >旧支付表</span>
				</span>
              </div>
          </div>
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>

<script type="text/javascript">
	var grid = null;
	var checkedCustomer = [];
	var selectedCountOccupy = 0;//已占用:xx条
	var selectedCountUnOccupy = 0;//未占用:xx条
	
    var termB = [];
    var termE = [];
    var isFinancingAmount = 0.00;
	var flag = $("#flag").val();
	
	$(function () {
		initFinancingTypeCd();
		initbuOrgCd();
		initLigerGrid();
	});
	
	//再融资状态
	function initFinancingTypeCd(){
		var financingTypeCdData = [{"id": "1", "text": "未占用"},{"id": "2", "text": "预占用"},{"id": "3", "text": "已占用"}];
		$("#financingTypeCd").ligerComboBox({ 
			data: financingTypeCdData,
			valueField: 'id', 
			textField: 'text',
			isMultiSelect: true
        });
	}
	
	//所属事业部
	function initbuOrgCd(){
		$("#buOrgCd").ligerComboBox({ 
			url: '<%=path%>/ass/asspackinfo/getbuOrgCd.do',
			ajaxType :'GET',
            slide: false,
            selectBoxHeight: 200,
            valueField: 'key', 
            textField: 'value',
            isMultiSelect: true
        });
		//下拉框赋值
		var _buOrgCdValue = $("#buOrgCdValue").val();
		if(_buOrgCdValue != ""){
			liger.get("buOrgCd").setValue(_buOrgCdValue);
		}
	}
	
	
	
	function initLigerGrid(){
		$("#searchBar").ligerForm({validate: true});
		var _url = '<%=path%>/ass/asspackinfo/initList.do';
		$("#ligergrid1").ligerGrid({
    		url : _url,
    		method : 'get',
    		parms : {"flag":flag},
        	columns: [
	            { display: '再融资状态', name: 'financingTypeNm', width: 80,
	            	render: function (rowdata, rowindex, value){
	            		if(rowdata.financingTypeCd == '2' || rowdata.financingTypeCd == '3' || rowdata.financingTypeCd == '4'){
	            			var h='<a href="javascript:showAssPackDetail(';
		            		h+="'"+rowdata.id+"','" + rowdata.minPd + "','" + rowdata.maxPd + "'";
		                    h+=')">'+rowdata.financingTypeNm+'</a>';
	            		}else{
	            			var h = rowdata.financingTypeNm;
	            		}
	            		return h;
	            	}
	            },
	            { display: '是否预约', name: 'isYl', width: 60,
	            	render: function (rowdata, rowindex, value){
	            		if(rowdata.isYl == '1' ){
	            			var h="是";
	            		}else{
	            			var h="否";
	            		}
	            		return h;
	            	}
	            },
	            { display: '客户名称', name: 'cstNm', width: 150 },
	            { display: '客户类型', name: 'cstTypNm', width: 100 },
	            { display: '合同编号', name: 'contractNumber', width: 150 },
	            { display: '事业部', name: 'buOrgNm', width: 150 },
	            { display: '支付表编号', name: 'paySchId', width: 200 },
	            { display: '起租日期', name: 'stDate', width: 100, render:renderDate},
	            { display: '可融资金额', name: 'financingAmount', width: 120 }
	        ],
	        pageSize:10, 
	        pageSizeOptions: [10,20,30,50,100,500,1000],
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        checkbox:true,
	        rownumbers:true,
	        isChecked: f_isChecked, 
	        onCheckRow: f_onCheckRow, 
	        onCheckAllRow: f_onCheckAllRow,
	        onBeforeCheckRow: function (checked, data, rowindex, rowobj){
                if (data.financingTypeCd == '2'||data.financingTypeCd == '4'){
                    return false;
                }
                return true;
            }
    	});
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	}
	
	$("#searchBtn").click(function(event) {
	    var form = new liger.get("searchBar");
		if (!form.valid()) {
			top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
			return false; //验证不通过，不执行以下代码
		}
		$("#flag").val("1");
	    var data = form.getData();
	    for (var name in data){
	       grid.setParm(name,data[name]);
	    };
	   grid.setParm("flag",$("#flag").val());
	   var fncInsIdQ = $("#fncInsIdQ").val();
	   if(fncInsIdQ != ''){
		   grid.setParm("fncInsIdQ",fncInsIdQ);
	   }
	   $("#selectedCount").html('0');
	   selectedCountOccupy = 0;
	   selectedCountUnOccupy = 0;
	   $("#selectedCountOccupy").html(selectedCountOccupy);
	   $("#selectedCountUnOccupy").html(selectedCountUnOccupy);
       $("#isFinancingAmount").html('0.00');
       isFinancingAmount = 0.00;
       checkedCustomer.splice(0,checkedCustomer.length);
       termB.splice(0,termB.length);
       termE.splice(0,termE.length);
	   grid.reload();
	});
	
	$("#clearBtn").click(function(event) {
	    $("#resetBtn").click();  //重置 input-text
	    var form = liger.get("searchBar");
	    form.setData({  //重置select等特殊表单
	        "fncCrdnlt": " ",
	        "stdt": "",
	        "eddt": "",
	        "cstTypCd": " ",
	        "buOrgCd": " ",       
	        "isMortgage": " ",
	        "isInsurance": " ",
	        "leaseTermMinQ": "",
	        "leaseTermMaxQ": "",
	        "surplusLeaseTermMinQ": "",
	        "surplusLeaseTermMaxQ": "",
	        "stDtQ": "",
	        "edDtQ": "",
	        "ovdDaysMin": "",
	        "ovdDaysMax": "",
	        "financingAmount": "",
	        "financingTypeCd": ""
	    });
	});
	
	function f_onCheckAllRow(checked){
        for (var rowid in this.records){
           if(checked)
               addCheckedCustomer(this.records[rowid], rowid);
           else
               removeCheckedCustomer(this.records[rowid]);
       	}
    }

    /*
    该例子实现 表单分页多选
    即利用onCheckRow将选中的行记忆下来，并利用isChecked将记忆下来的行初始化选中
    */
    function findCheckedCustomer(CustomerID){
        for(var i =0;i<checkedCustomer.length;i++){
            if(checkedCustomer[i] == CustomerID) return i;
        }
        return -1;
    }
    //选择支付表 
    function addCheckedCustomer(data, rowid){
    	//预占用 已预约的不让选
    	//如果已经关联项目的不让选已占用
    	if(data.financingTypeCd == '2'||data.financingTypeCd == '4'||data.isYl=="1"
    			<c:if test="${prjid != null}">
    			||data.financingTypeCd == '3'
    			</c:if>
    	){   
    		var manager = $("#ligergrid1").ligerGetGridManager();
    		manager.unselect(rowid);
    	}else{
	        if(findCheckedCustomer(data.id) == -1){
	            checkedCustomer.push(data.id);
	        	termB.push(data.minPd);
	        	termE.push(data.maxPd);
	        	isFinancingAmount = parseFloat(isFinancingAmount + data.financingAmount);
	        	$("#selectedCount").html(checkedCustomer.length);
	        	if(data.financingTypeCd == '1'){//未占用
	        		$("#selectedCountUnOccupy").html(++selectedCountUnOccupy);
	        	}else if(data.financingTypeCd == '3'){//已占用
	        		$("#selectedCountOccupy").html(++selectedCountOccupy);
	        	}
	        	
	        	$("#isFinancingAmount").html(isFinancingAmount.toFixed(2));
	        }
    	}
    }
    function removeCheckedCustomer(data){
        var i = findCheckedCustomer(data.id);
        if(i==-1) return;
        checkedCustomer.splice(i,1);
        termB.splice(i,1);
    	termE.splice(i,1);
    	isFinancingAmount = parseFloat(isFinancingAmount - data.financingAmount);
    	$("#selectedCount").html(checkedCustomer.length);
    	if(data.financingTypeCd == '1'){//未占用
    		$("#selectedCountUnOccupy").html(--selectedCountUnOccupy);
    	}else if(data.financingTypeCd == '3'){//已占用
    		$("#selectedCountOccupy").html(--selectedCountOccupy);
    	}
    	if(isFinancingAmount < 0){
    		isFinancingAmount = 0.00;
    	}
    	$("#isFinancingAmount").html(isFinancingAmount.toFixed(2));
    }
    function f_isChecked(rowdata){
        if (findCheckedCustomer(rowdata.id) == -1)
            return false;
        return true;
    }
    function f_onCheckRow(checked, data, rowid,rowdata){
        if (checked) addCheckedCustomer(data, rowid);
        else removeCheckedCustomer(data);
    }
    
    //是否添加资产包名称
    function addAssPackInfo(data){
//    	if(checkedCustomer.join(',') == '' && $("#sflag").val()=='0'){
//			top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_MORE_ROW , SQ_type: "warning" });
//	    	return false; //验证不通过，不执行以下代码
//		}
    	//添加资产包名称
		if(data == "0" && $("#fncInsIdQ").val() == "" ){
			addAssPackNm(data);
		}else{
			add(data);
		}
    	/* var _data = $("form").serializeArray();
    	alert(JSON.stringify(_data)); */
    }
	
	 //新增数据
	function add(data){
		//if(checkedCustomer.join(',') != ''){
			$("#flag").val("1");
	   		grid.setParm("flag",$("#flag").val());
			var _data = $("form").serializeArray();
			var _payRltvInfo = checkedCustomer.join(',');
			var _termB = termB.join(',');
			var _termE = termE.join(',');
			var fncInsIdQ = $("#fncInsIdQ").val();
			_data.push({"name":"payRltvInfo", "value": _payRltvInfo});
			_data.push({"name":"termB", "value": _termB});
			_data.push({"name":"termE", "value": _termE});
			_data.push({"name":"mark", "value": data});
			_data.push({"name":"fncInsIdQ", "value": fncInsIdQ});
			
			var _url = '<%=path%>/ass/asspackinfo/add.do';
			//发送异步请求校验
			var wait_dialog;
			$.ajax({
				type: 'post',
				dataType: 'json',
				data: _data,
				url: _url,
				beforeSend: function(){
			          wait_dialog=top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},
				success:function(msg){
					 wait_dialog.close();
					 if(msg.success == 1){
						top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
						if($("#fncInsIdQ").val() != ''){
							parent.reloadAssPackInfoList();
						}
						frameElement.dialog.close();
					 }else if(msg.success == 0 && !msg.data){//校验不成功,且没有data(id)报错
						top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
						frameElement.dialog.close();
					 }
				}
			});
		
	}
	
	//新增全部数据-20181015-JL
	function addAllAssPackInfo(param){
		if($("#fncInsIdQ").val() == "" ){
			//添加资产包名称
			addAssPackNm(param);
		}else{
			//新增全部资产
	   		grid.setParm("flag",$("#flag").val());
			var _data = $("form").serializeArray();
			var fncInsIdQ = $("#fncInsIdQ").val();
			_data.push({"name":"mark", "value": param});
			_data.push({"name":"fncInsIdQ", "value": fncInsIdQ});
			
			var _url = '<%=path%>/ass/asspackinfo/addAllAssPackInfo.do';
			//发送异步请求校验
			var wait_dialog;
			$.ajax({
				type: 'post',
				dataType: 'json',
				data: _data,
				url: _url,
				beforeSend: function(){
			          wait_dialog=top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},
				success:function(msg){
					 wait_dialog.close();
					 if(msg.success == 1){
						top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
						if($("#fncInsIdQ").val() != ''){
							parent.reloadAssPackInfoList();
						}
						frameElement.dialog.close();
					 }else if(msg.success == 0 && !msg.data){//校验不成功,且没有data(id)报错
						top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
						frameElement.dialog.close();
					 }
				}
			});
			//防止网络延迟多次提交
			$("#flag").val("0");
		}
	}
	 
	//添加资产包名称
	function addAssPackNm(data){
		$.ligerDialog.SQopen({
            cls: 'noBorder_Dialog',
            width: 430,
            height:120,
            title : '新增资产包名称',
            url:'<%=path%>/ass/asspackinfo/toAddPackInfo.do?flag='+data,
            // 自定义buttons的时候 不要设置 fixButtons: true
            buttons: [{
                    text: "保存", type: 'ok', cls: 'l-dialog-btn-ok', 
                    onclick: function (item, Dialog) {
                        //在子页面里绑定 frameElement.dialog.onOk = function () {}
                        if (Dialog.onOk) {
                        	Dialog.onOk();
                        }
                        
                    }
                }, {
                    text: "取消", type: 'cancel', cls: 'l-dialog-btn-no', 
                    onclick: function (item, Dialog) {
                        //在子页面里绑定 frameElement.dialog.onCancel = function () {}
                        if (Dialog.onCancel) Dialog.onCancel();
                    }
                }
            ]
        });
	}
	 
	function ReadExcel(){ 
		var form = new liger.get("searchBar");
		if (!form.valid()) {
			top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO,SQ_type: "warning"});
			return false; //验证不通过，不执行以下代码
		}
		$("#flag").val("2");
	   	grid.setParm("flag",$("#flag").val());
	    var data = form.getData();
	    for (var name in data){
	       grid.setParm(name,data[name]);
	    };
	   	grid.setParm("fncCrdnlt",$("#fncCrdnlt").val());
	   	$("#selectedCount").html('0');
	   	selectedCountOccupy = 0;
	    selectedCountUnOccupy = 0;
	    $("#selectedCountOccupy").html(selectedCountOccupy);
	    $("#selectedCountUnOccupy").html(selectedCountUnOccupy);
       	$("#isFinancingAmount").html('0.00');
       	isFinancingAmount = 0.00;
       	checkedCustomer.splice(0,checkedCustomer.length);
       	termB.splice(0,termB.length);
       	termE.splice(0,termE.length);
		var file=$("#upfile").val()
		$.ajaxFileUpload({  
		    url : "<%=path%>/ass/asspackinfo/importExcel.do",  
		    dataType : 'json',  
		    data : {},
		    secureuri : false,  
		    fileElementId :"upfile",  
		    success : function(msg) { //服务器成功响应处理函数  
		    	 if(msg.success == 1){
		    		 if(msg.data == ""){
		    			 top.$.ligerDialog.SQalert({content: "上传的EXCEL支付表编号为空",SQ_type: "success"});
		    		 }else{
			    		 //grid.setParm("paySchCds",msg.data);
			    		 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
			    		 if(msg.id == 1){
			    			 $("#sflag").val("1");
			    		 }
			    		 grid.reload();
		    		 }
    			 }else{
    				 top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
    			 }  
		        }  
		    });  
	}
	
	//查看占用详情
	function showAssPackDetail(payId,minPd,maxPd){
		$.ligerDialog.SQopen({
            cls: 'noBorder_Dialog',
            width: 700,
            height:500,
            title : '资产包占用详情',
            url:'<%=path%>/ass/asspackinfo/showAssPackOccupyDetail.do?payId='+payId+'&minPd='+minPd+'&maxPd='+maxPd,
            // 自定义buttons的时候 不要设置 fixButtons: true
            buttons: [{
                    text: "取消", type: 'cancel', cls: 'l-dialog-btn-no2', 
                    onclick: function (item, Dialog) {
                        //在子页面里绑定 frameElement.dialog.onCancel = function () {}
                        if (Dialog.onCancel) Dialog.onCancel();
                    }
                }
            ]
        });
	}
	
	
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    };
	}
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	
	
	//关闭按钮
	if($("#fncInsIdQ").val() != ''){
		frameElement.dialog.onCancel = function () {
			parent.reloadAssPackInfoList();
			frameElement.dialog.close(); 
		}
	}
	//查看导入的旧支付表号
	function showOldPayCode(){
		$.ligerDialog.SQopen({
            cls: 'noBorder_Dialog',
            width: 500,
            height:500,
            title : '导入的旧支付表号',
            url:'<%=path%>/ass/asspackinfo/showOldPayCode.do',
            // 自定义buttons的时候 不要设置 fixButtons: true
            buttons: [{
                    text: "关闭", type: 'cancel', cls: 'l-dialog-btn-no2', 
                    onclick: function (item, Dialog) {
                        //在子页面里绑定 frameElement.dialog.onCancel = function () {}
                        if (Dialog.onCancel) Dialog.onCancel();
                    }
                }
            ]
        });
	}
</script>


</body>
</html>